Improve parser error reporting#28
Conversation
acf9710 to
a65c5a7
Compare
seddonym
left a comment
There was a problem hiding this comment.
Wow what a clever crate!
Left a couple of non-blocking comments, feel free to merge.
|
|
||
| message = str(exc_info.value) | ||
|
|
||
| # Recombine first line if it was too long |
There was a problem hiding this comment.
Is this because there's a dependency on something like the system line length? I wonder if there's a way to make it deterministic so we don't need to do this. (No big deal though.)
There was a problem hiding this comment.
Yeah, when testing locally, the file_path is an absolute path, which was too long to fit on one line. I would have liked to make it deterministic, but I couldn't think of a clean way to do it. We probably do want absolute paths rather than relative (relative to what?) in real use.
tests/test_python_interface.py
Outdated
| message = "\n".join(lines) | ||
| # End recombination | ||
|
|
||
| assert message == f"""\ |
There was a problem hiding this comment.
🐼 Sometimes I like to use textutils.dedent so the string can match the indentation level of the test.
There was a problem hiding this comment.
Yeah, I considered that, but decided in this case this was good enough.
|
Oh - might be worth adding a line to the CHANGELOG about this, but no big deal. |
This uses the wonderful `miette` crate for annotating the `.flt` file source code.
a65c5a7 to
97e314c
Compare
Convert fluent errors into annotated source code, using the
miettecrate.